﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Security.Cryptography.X509Certificates;
using System.ServiceModel;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using System.Text;
using System.Threading.Tasks;
using EvalServiceLibrary;

namespace ConsoleHost
{
    class Program
    {
        static void Main(string[] args)
        {
            ServiceHost host = new ServiceHost(typeof(EvalService));
            /*
            host.AddServiceEndpoint(typeof (IEvalService), new BasicHttpBinding(),new Uri("http://localhost:8080/evals/basic"));
            host.AddServiceEndpoint(typeof(IEvalService), new WSHttpBinding(),new Uri("http://localhost:8080/evals/ws"));
            host.AddServiceEndpoint(typeof(IEvalService), new NetTcpBinding(),new Uri("net.tcp://localhost:8081/evals"));
            */
            try
            {
                host.Open();
                PrintServerInfo(host);
                Console.ReadLine();
                host.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                host.Abort();
            }

        }

        private static void PrintServerInfo(ServiceHost host)
        {
            Console.WriteLine("{0} this server ins running with...",
                host.Description.ServiceType);
            foreach (ServiceEndpoint se in host.Description.Endpoints)
            {
                Console.WriteLine(se.Address);
            }
        }

    }
}
